package fun.wlfj.j2t.model;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class Constructer extends Element {
	public List<Element> paramList = new ArrayList<>();
	public Constructer(String name, Element... args) {
		super(name);
		paramList.addAll(List.of(args));
	}
	
	public void addParam(Element arg) {
		paramList.add(arg);
	}

	public String strRepr() {
		// A(int, int)
		String args = 
				paramList.stream().map(e -> e.name)
				.collect(Collectors.joining(", "));
		return name + "(" + args + ")";
	}
}
